pit (one's) wits against (someone)

Translations
se mesurer à quelqu'un
Definitions
To engage in a battle of intelligence or cunning with someone, often in a competitive or adversarial context.